export const getWeekday = () => {
  var d = new Date()
  var weekday = new Array(7)
  weekday[0] = '星期日'
  weekday[1] = '星期一'
  weekday[2] = '星期二'
  weekday[3] = '星期三'
  weekday[4] = '星期四'
  weekday[5] = '星期五'
  weekday[6] = '星期六'
  return weekday[d.getDay()]
}

export const getCurrentTime = () => {
  var currentTime = new Date()
  var hour = currentTime.getHours()
  var period
  if (hour >= 0 && hour <= 11) {
    period = '上午'
  } else if (hour >= 12 && hour <= 17) {
    period = '下午'
  } else {
    period = '晚上'
  }

  var formattedHour = currentTime.getHours().toString().padStart(2, '0')
  var formattedMinutes = currentTime.getMinutes().toString().padStart(2, '0')

  return period + formattedHour + ':' + formattedMinutes
}
